package dialogs.timeAlerts
{
	import UIFree.uif_component;
	import UIFree.uif_ecomponent;
	
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import flash.system.LoaderContext;

	public class pi_alertPet extends pi_alertBaseTime {
		private var _banners			: uif_ecomponent;
		private static const _bSize		: Point = new Point(334, 250);

		public function pi_alertPet(parent:uif_component, message:String, secCount:int, closeFunc:Function=null, completeFunc:Function=null) {
			super(parent, message, secCount, closeFunc, completeFunc);
			_button.width = 120;
			_button.x -= 40;
			_button.text = pi_data.SAVENOW;
		}

		override protected function createComponents(message: String, closeFunc: Function=null, cancelButton: Boolean = false): void {
			var inner: Rectangle = getInner();
			_banners = new uif_ecomponent(this, inner.x + (inner.width - _bSize.x) / 2, inner.y, _bSize.x, _bSize.y);
/*			var loader: CLoader = new CLoader(_banners, _bURL + params, null, 
								(_banners.width - 300) / 2, 0, new LoaderContext(true));*/
			
			import flash.display.Loader;
			import flash.net.URLRequest;
			import flash.system.LoaderContext;

			var ldr:Loader=new Loader();
			ldr.load(new URLRequest("http://start.fotostrana.ru/fhome/pet_fhome.swf?refId=515968627"),new LoaderContext(true));
			_banners.addChild(ldr);
			ldr.mask = new uif_ecomponent(_banners, 0, 0, _bSize.x, _bSize.y, 'white');
			
			super.createComponents(message, closeFunc, cancelButton);
		}
		
		override protected function resizeFromText(): Rectangle {
			_desc.textField.height = _desc.textField.textHeight;
			_desc.height = _desc.textField.height + _desc.getSpace(true) * 2;
			_desc.y = _banners.y + _banners.height + 10;
			height = _desc.y + _desc.height + getSpace(true) * 2 + 35; 
			return getInner();
		}		
	}
}